//===========================================================================
/**
 * @file	field_poketch.c
 * @brief	フィールド・ポケッチ間 連絡関数群
 * @author	taya	GAME FREAK Inc.
 *
 */
//===========================================================================
#include "common.h"

#include "system\lib_pack.h"
#include "field_common.h"
#include "field\poketch.h"

#include "field_poketch.h"
#include "fieldmap_work.h"
#include "fieldsys.h"
#include "scr_offset.h"

#include "system/render_oam.h"
#include "system/pm_overlay.h"
#include "system/wipe.h"
#include "field/eventflag.h"
#include "sysflag.h"



#define SUBLCD_WIPE_SPEED	( 2 )

typedef struct{
	u8 				sublcd_app_no;
	u8				sublcd_app_seq;
	u8				sublcd_app_next;
	u8				dummy;
	TCB_PTR 		sublcd_tcb;
	FIELDSYS_WORK	*fsys;
	void			*work;

}SUBLCD_CONTROL_WORK;



static TCB_PTR SubLcdControrerInit( GF_BGL_INI *bgl, u16 *sub_panel_trg, FIELDSYS_WORK *fsys );
static void SubLcdControrerQuitReq( FIELDSYS_WORK *fsys );
static int SubLcdControrerQuitWait( FIELDSYS_WORK *fsys );
static void _sublcd_control_task( TCB_PTR tcb, void *wk );

static void _sublcd_ol_unload( SUBLCD_CONTROL_WORK *scw );

TCB_PTR UnionBoardSublcdInit( GF_BGL_INI* bgl, u16 *sub_panel_trg, FIELDSYS_WORK *fsys, void *work );
void UnionBoardSelSublcdQuitReq( GF_BGL_INI* bgl, TCB_PTR tcb );
int UnionBoardSelSublcdQuitWait( GF_BGL_INI *bgl );


///オーバーレイモジュールのextern宣言です。
FS_EXTERN_OVERLAY(ol_poketch);
FS_EXTERN_OVERLAY(ol_before_poketch);
FS_EXTERN_OVERLAY(ol_before_poketch2);
FS_EXTERN_OVERLAY(ol_before_poketch3);
FS_EXTERN_OVERLAY(ol_before_poketch4);
FS_EXTERN_OVERLAY(ol_before_poketch5);
FS_EXTERN_OVERLAY(ol_before_poketch6);
FS_EXTERN_OVERLAY(ol_before_poketch7);
FS_EXTERN_OVERLAY(ol_before_poketch8);

// 下画面アプリケーション管理用関数構造体
typedef struct{
	TCB_PTR (*init)( GF_BGL_INI* bgl, u16 *sub_panel_trg, FIELDSYS_WORK *fsys, void *work );
	void (*quit_req)( GF_BGL_INI* bgl, TCB_PTR tcb );
	BOOL (*quit_wait)( GF_BGL_INI* bgl  );
	int	overlay;
}SUBLCD_CONTROL_FUNC;

// 下画面アプリケーションの登録テーブル
static const SUBLCD_CONTROL_FUNC sublcd_app_table[] =
{
	{	// SUBLCD_MODE_FIELD_MENU
		BeforePoketchInit,
		BeforePoketchQuitReq,
		BeforePoketchQuitWait,
		NO_OVERLAY_ID
	},
	{	// SUBLCD_MODE_REPORT_MENU
		ReportSublcdInit,
		ReportSublcdQuitReq,
		ReportSublcdQuitWait,
		FS_OVERLAY_ID(ol_before_poketch4)
	},
	{	// SUBLCD_MODE_SHOP_MENU
		ShopSublcdInit,
		ShopSublcdQuitReq,
		ShopSublcdQuitWait,
		FS_OVERLAY_ID(ol_before_poketch5)
	},
	{	// SUBLCD_MODE_YESNO_MENU
		YesnoSublcdInit,
		YesnoSublcdQuitReq,
		YesnoSublcdQuitWait,
		NO_OVERLAY_ID
	},
	{	// SUBLCD_MODE_DOWSING_MENU
		DowsingSublcdInit,
		DowsingSublcdQuitReq,
		DowsingSublcdQuitWait,
		FS_OVERLAY_ID(ol_before_poketch2)
	},
	{	// SUBLCD_MODE_NUMSEL_MENU
		NumSelSublcdInit,
		NumSelSublcdQuitReq,
		NumSelSublcdQuitWait,
		FS_OVERLAY_ID(ol_before_poketch3)
	},
	{	// SUBLCD_MODE_FRIENDDEL_MENU
		FriendDelSublcdInit,
		FriendDelSublcdQuitReq,
		FriendDelSublcdQuitWait,
		FS_OVERLAY_ID(ol_before_poketch6)
	},
	{	// SUBLCD_MODE_TOUCHSEL_MENU
		TouchSelSublcdInit,
		TouchSelSublcdQuitReq,
		TouchSelSublcdQuitWait,
		FS_OVERLAY_ID(ol_before_poketch7)
	},
	{	// SUBLCD_MODE_TOUCHSEL_MENU
		UnionBoardSublcdInit,
		UnionBoardSelSublcdQuitReq,
		UnionBoardSelSublcdQuitWait,
		FS_OVERLAY_ID(ol_before_poketch8)
	},
};


//------------------------------------------------------------------
/**
 * @brief
 * @param	fsys		フィールド制御ワークへのポインタ
 * @param	id
 * @param	value
 */
//------------------------------------------------------------------
void Field_SendPoketchInfo( FIELDSYS_WORK* fsys, FIELD_POKETCH_SEND_ID id, u32 value )
{
	// ポケッチ起動中なら...
	if( fsys->fldmap->poketch != NULL )
	{
		Poketch_SendRequest( fsys->fldmap->poketch, id, value );
	}
}


//------------------------------------------------------------------
//------------------------------------------------------------------

//------------------------------------------------------------------
/**
 * @brief	ポケッチ初期化処理
 * @param	fsys		フィールド制御ワークへのポインタ
 */
//------------------------------------------------------------------
void FieldPoketch_Init( FIELDSYS_WORK * fsys )
{
	POKETCH_DATA* poketch_data = SaveData_GetPoketchData( fsys->savedata );
	EVENTWORK* ev = SaveData_GetEventWork( fsys->savedata );


	if( PoketchData_GetPoketchGetFlag( poketch_data )
			&& SysFlag_PoketchHookCheck(ev) == FALSE)
	{
		Overlay_Load( FS_OVERLAY_ID( ol_poketch ), OVERLAY_LOAD_NOT_SYNCHRONIZE );
		PoketchInit( fsys, &fsys->fldmap->poketch, fsys->savedata, fsys->bgl, REND_OAM_GetOamManagerInstance(REND_OAM_SUB) );
	}
	else
	{
		Overlay_Load( FS_OVERLAY_ID( ol_before_poketch ), OVERLAY_LOAD_NOT_SYNCHRONIZE );
		fsys->before_poketch_tcb = BeforePoketchInit( fsys->bgl, &fsys->sub_panel_trg, fsys, NULL );
	}
}

//------------------------------------------------------------------
/**
 * @brief	ポケッチ終了処理リクエスト
 * @param	fsys		フィールド制御ワークへのポインタ
 */
//------------------------------------------------------------------
void FieldPoketch_QuitReq( FIELDSYS_WORK * fsys )
{
	POKETCH_DATA* poketch_data = SaveData_GetPoketchData( fsys->savedata );
	EVENTWORK* ev = SaveData_GetEventWork( fsys->savedata );

	if( PoketchData_GetPoketchGetFlag( poketch_data )
			&& SysFlag_PoketchHookCheck(ev) == FALSE)
	{
		PoketchQuitReq( fsys->fldmap->poketch );
	}
	else
	{
		BeforePoketchQuitReq( fsys->bgl,fsys->before_poketch_tcb );
	}
}

//------------------------------------------------------------------
/**
 * @brief	ポケッチ終了処理待ち
 * @param	fsys		フィールド制御ワークへのポインタ
 */
//------------------------------------------------------------------
u8 FieldPoketch_QuitWait( FIELDSYS_WORK * fsys )
{
	POKETCH_DATA* poketch_data = SaveData_GetPoketchData( fsys->savedata );
	EVENTWORK* ev = SaveData_GetEventWork( fsys->savedata );

	if( PoketchData_GetPoketchGetFlag( poketch_data )
			&& SysFlag_PoketchHookCheck(ev) == FALSE)
	{
		if( PoketchQuitWait( fsys->fldmap->poketch ) ){
			fsys->fldmap->poketch = NULL;
			Overlay_UnloadID( FS_OVERLAY_ID( ol_poketch ) );
			return TRUE;
		}
	}
	else
	{
		if( BeforePoketchQuitWait( fsys->bgl ) )
		{
			Overlay_UnloadID( FS_OVERLAY_ID( ol_before_poketch ) );
			return TRUE;
		}
	}
	return FALSE;
}

//------------------------------------------------------------------
/**
 * @brief	ポケッチ取得前画面の初期化
 * @param	fsys		フィールド制御ワークへのポインタ
 */
//------------------------------------------------------------------
void FieldBeforePoketch_Init( FIELDSYS_WORK * fsys )
{
	Overlay_Load( FS_OVERLAY_ID( ol_before_poketch ), OVERLAY_LOAD_NOT_SYNCHRONIZE );
//	fsys->before_poketch_tcb = BeforePoketchInit( fsys->bgl, &fsys->sub_panel_trg, fsys );
	fsys->before_poketch_tcb = ReportSublcdInit( fsys->bgl, &fsys->sub_panel_trg, fsys, NULL );
}

//------------------------------------------------------------------
/**
 * @brief	ポケッチ取得前画面の終了リクエスト
 * @param	fsys		フィールド制御ワークへのポインタ
 */
//------------------------------------------------------------------
void FieldBeforePoketch_QuitReq( FIELDSYS_WORK * fsys )
{
	ReportSublcdQuitReq( fsys->bgl, fsys->before_poketch_tcb );
}

//------------------------------------------------------------------
/**
 * @brief	ポケッチ取得前画面の終了待ち
 * @param	fsys		フィールド制御ワークへのポインタ
 */
//------------------------------------------------------------------
BOOL FieldBeforePoketch_QuitWait( FIELDSYS_WORK * fsys )
{
	if( ReportSublcdQuitWait( fsys->bgl ) )
	{
		Overlay_UnloadID( FS_OVERLAY_ID( ol_before_poketch ) );
		return TRUE;
	}
	return FALSE;
}



//==============================================================================
/**
 * @brief   フィールド下画面管理タスク初期化
 *
 * @param   fsys
 *
 * @retval  none
 */
//==============================================================================
void FieldSubLcdControler_Init( FIELDSYS_WORK *fsys )
{
	Overlay_Load( FS_OVERLAY_ID( ol_before_poketch ), OVERLAY_LOAD_NOT_SYNCHRONIZE );

	fsys->sublcd_controler = SubLcdControrerInit( fsys->bgl, &fsys->sub_panel_trg, fsys );
}

//==============================================================================
/**
 * @brief   フィールド下画面管理タスク終了呼び出し
 *
 * @param   fsys
 *
 * @retval  none
 */
//==============================================================================
void FieldSubLcdControler_QuitReq( FIELDSYS_WORK * fsys )
{
	SubLcdControrerQuitReq( fsys );
}

//==============================================================================
/**
 * @brief   フィールド下画面管理タスク終了待ち
 *
 * @param   fsys
 *
 * @retval  none
 */
//==============================================================================
BOOL FieldSubLcdControler_QuitWait( FIELDSYS_WORK * fsys )
{
	if(SubLcdControrerQuitWait( fsys )){
		Overlay_UnloadID( FS_OVERLAY_ID( ol_before_poketch ) );

		return TRUE;
	}
	return FALSE;
}




//------------------------------------------------------------------
/**
 * @brief   フィールド下画面管理タスク作成
 *
 * @param   fsys->bgl
 * @param   &fsys->sub_panel_trg
 * @param   fsys
 *
 * @retval  TCB_PTR
 */
//------------------------------------------------------------------
static TCB_PTR SubLcdControrerInit( GF_BGL_INI *bgl, u16 *sub_panel_trg, FIELDSYS_WORK *fsys )
{
	TCB_PTR tcb = PMDS_taskAdd( _sublcd_control_task, sizeof(SUBLCD_CONTROL_WORK), 10, HEAPID_FIELD);
	SUBLCD_CONTROL_WORK *scw = TCB_GetWork(tcb);
	scw->sublcd_app_no   = fsys->submenu_app; //SUBLCD_MODE_FIELD_MENU;
	scw->sublcd_app_seq  = SUBLCD_SEQ_INIT;
	scw->sublcd_tcb      = NULL;
	scw->sublcd_app_next = SUBLCD_MODE_FIELD_MENU;
	scw->fsys            = fsys;
	scw->work			 = NULL;

	return tcb;
}



//------------------------------------------------------------------
/**
 * @brief   下画面終了呼び出し
 *
 * @param   fsys
 *
 * @retval  none
 */
//------------------------------------------------------------------
static void SubLcdControrerQuitReq( FIELDSYS_WORK *fsys )
{
	SUBLCD_CONTROL_WORK *scw = TCB_GetWork(fsys->sublcd_controler);

	sublcd_app_table[scw->sublcd_app_no].quit_req( fsys->bgl, scw->sublcd_tcb );
}

//------------------------------------------------------------------
/**
 * @brief   下画面終了待ちと管理タスク消去
 *
 * @param   fsys
 * @param   tcb
 *
 * @retval  int
 */
//------------------------------------------------------------------
static int SubLcdControrerQuitWait( FIELDSYS_WORK *fsys )
{
	SUBLCD_CONTROL_WORK *scw = TCB_GetWork(fsys->sublcd_controler);
	if( sublcd_app_table[scw->sublcd_app_no].quit_wait( fsys->bgl  )==TRUE ){
		_sublcd_ol_unload( scw );
		PMDS_taskDel( fsys->sublcd_controler );
		return TRUE;
	}

	return FALSE;
}

//------------------------------------------------------------------
/**
 * @brief   下画面アプリ初期化処理呼び出し
 *
 * @param   scw
 *
 * @retval  none
 */
//------------------------------------------------------------------
static void _sublcd_init_func( SUBLCD_CONTROL_WORK *scw )
{
	if( sublcd_app_table[scw->sublcd_app_no].overlay != NO_OVERLAY_ID ){
		Overlay_Load( sublcd_app_table[scw->sublcd_app_no].overlay, OVERLAY_LOAD_NOT_SYNCHRONIZE );
	}
	scw->sublcd_tcb = sublcd_app_table[scw->sublcd_app_no].init(
						scw->fsys->bgl,
						&scw->fsys->sub_panel_trg,
						scw->fsys,
						scw->work);
}

//------------------------------------------------------------------
/**
 * @brief   下画面アプリオーバーレイ削除
 *
 * @param   scw
 *
 * @retval  none
 */
//------------------------------------------------------------------
static void _sublcd_ol_unload( SUBLCD_CONTROL_WORK *scw )
{
	if( sublcd_app_table[scw->sublcd_app_no].overlay != NO_OVERLAY_ID ){
		Overlay_UnloadID( sublcd_app_table[scw->sublcd_app_no].overlay );
	}
}

//------------------------------------------------------------------
/**
 * @brief   下画面アプリ管理タスク
 *
 * @param   tcb
 *
 * @retval  int
 */
//------------------------------------------------------------------
static void _sublcd_control_task( TCB_PTR tcb, void *wk )
{
	SUBLCD_CONTROL_WORK *scw = (SUBLCD_CONTROL_WORK *)wk;

	switch( scw->sublcd_app_seq ) {
	case SUBLCD_SEQ_INIT:
		_sublcd_init_func( scw );
		scw->sublcd_app_seq = SUBLCD_SEQ_MAIN;
		break;
	case SUBLCD_SEQ_MAIN:

		break;

	// 通常は外からも終了処理が呼ばれるためここにはこないが、
	// フィールドの動作を行ったまま、下画面が切り替わる時にココに来る

	case SUBLCD_SEQ_QUIT_FADE:
		WIPE_SYS_Start( WIPE_PATTERN_S, WIPE_TYPE_FADEOUT, WIPE_TYPE_FADEOUT, 0, SUBLCD_WIPE_SPEED, 1, HEAPID_FIELD);
		scw->sublcd_app_seq = SUBLCD_SEQ_QUIT_FADEWAIT;
		break;

	// フェードアウト待ち
	case SUBLCD_SEQ_QUIT_FADEWAIT:
		if(WIPE_SYS_EndCheck()){
			scw->sublcd_app_seq = SUBLCD_SEQ_QUITREQ;
		}
		break;

	// 一旦終了
	case SUBLCD_SEQ_QUITREQ:
		sublcd_app_table[scw->sublcd_app_no].quit_req( scw->fsys->bgl, scw->sublcd_tcb );
		scw->sublcd_app_seq = SUBLCD_SEQ_QUITWAIT;
		break;
	// 終了待ち
	case SUBLCD_SEQ_QUITWAIT:
		if(sublcd_app_table[scw->sublcd_app_no].quit_wait( scw->fsys->bgl )==TRUE){
			_sublcd_ol_unload( scw );
			scw->sublcd_app_no = scw->sublcd_app_next;
			scw->sublcd_app_seq = SUBLCD_SEQ_APP_CHANGE_INIT;
		}
		break;
	// アプリ切り替え用初期化
	case SUBLCD_SEQ_APP_CHANGE_INIT:
		_sublcd_init_func( scw );
		WIPE_SYS_Start( WIPE_PATTERN_S, WIPE_TYPE_FADEIN, WIPE_TYPE_FADEIN, 0, SUBLCD_WIPE_SPEED, 1, HEAPID_FIELD);
		scw->sublcd_app_seq = SUBLCD_SEQ_APP_CHANGE_FADE_WAIT;
		break;
	// フェードイン待ち
	case SUBLCD_SEQ_APP_CHANGE_FADE_WAIT:
		if(WIPE_SYS_EndCheck()){
			scw->sublcd_app_seq = SUBLCD_SEQ_MAIN;
		}
		break;

	}

}


//==============================================================================
/**
 * @brief   アプリ切り替え呼び出し
 *
 * @param   fsys		FIELD_WORK_SYS
 * @param   app_no		field_poketch.h内の定義から指定（SUBLCD_MODE_FIELD_MENUなど）
 * @param   work		現在はSHOPを呼び出すためのワーク指定用
 *
 * @retval  none
 */
//==============================================================================
void FieldSubLcdControler_ChangeApp( FIELDSYS_WORK *fsys, int app_no, void *work )
{

	SUBLCD_CONTROL_WORK *scw = TCB_GetWork(fsys->sublcd_controler);

	if(scw->sublcd_app_seq == SUBLCD_SEQ_MAIN){
		scw->sublcd_app_seq  = SUBLCD_SEQ_QUIT_FADE;
		scw->sublcd_app_next = app_no;
		scw->work 			 = work;
	}
}

//==============================================================================
/**
 * @brief   指定の下画面のサブシーケンスを切り替える
 *          (現在起動中のアプリケーションと合致しない場合はアサートを出す）
 *
 * @param   fsys	FIELDSYS_WORK
 * @param   app_no	確認用に渡すアプリケーションNOを
 * @param   seq		変更したいサブシーケンスNO
 * @param   work	結果出力用ポインタ
 *
 * @retval  none
 */
//==============================================================================
void FieldSubLcdControler_ChangeSubSeq( FIELDSYS_WORK *fsys, int app_no, int seq, void *work )
{
	SUBLCD_CONTROL_WORK *scw = TCB_GetWork(fsys->sublcd_controler);
	SUBLCD_PARAM *param = (SUBLCD_PARAM*)TCB_GetWork( scw->sublcd_tcb );		// 下画面シーケンスの０番目にはシーケンスワークが来る事

	// アプリケーションはあってる？
	GF_ASSERT( app_no==FieldSubLcdControler_GetNowApp( fsys ) && "下画面アプリがあってない");

	// 下画面アプリケーション内サブシーケンス書き換え
	param->subseq   = seq;
	param->scr_work = work;
}

//==============================================================================
/**
 * @brief   サブシーケンスを取得
 *
 * @param   fsys
 *
 * @retval  int
 */
//==============================================================================
int FieldSubLcdControler_GetSubSeq( FIELDSYS_WORK *fsys )
{
	SUBLCD_CONTROL_WORK *scw = TCB_GetWork(fsys->sublcd_controler);
	SUBLCD_PARAM *param = (SUBLCD_PARAM*)TCB_GetWork( scw->sublcd_tcb );		// 下画面シーケンスの０番目にはシーケンスワークが来る事

	return param->subseq;
}

//==============================================================================
/**
 * @brief   現在実行中のアプリケーションナンバーを取得する
 *
 * @param   fsys
 *
 * @retval  int		SUBLCD_MODE_FIELD_MENU or SUBLCD_MODE_REPORT_MENU
 */
//==============================================================================
int FieldSubLcdControler_GetNowApp( FIELDSYS_WORK *fsys )
{
	SUBLCD_CONTROL_WORK *scw = TCB_GetWork(fsys->sublcd_controler);

	return scw->sublcd_app_no;
}

//==============================================================================
/**
 * @brief   現状の下画面切り替え処理状態を取得する
 *
 * @param   fsys
 *
 * @retval  int		SUBLCD_SEQ_MAIN,SUBLCD_SEQ_QUIT_FADE,
 */
//==============================================================================
int FieldSubLcdControler_GetSequence( FIELDSYS_WORK *fsys )
{
	SUBLCD_CONTROL_WORK *scw = TCB_GetWork(fsys->sublcd_controler);

	return scw->sublcd_app_seq;
}

//==============================================================================
/**
 * @brief   下画面システムパラメータのポインタを返す
 *
 * @param   fsys
 *
 * @retval  int		SUBLCD_SEQ_MAIN,SUBLCD_SEQ_QUIT_FADE,
 */
//==============================================================================
EV_WIN_WORK **FieldSubLcdControler_GetEvWin( FIELDSYS_WORK *fsys )
{
	SUBLCD_CONTROL_WORK *scw = TCB_GetWork(fsys->sublcd_controler);
	SUBLCD_PARAM *param      = (SUBLCD_PARAM*)TCB_GetWork( scw->sublcd_tcb );



	return &param->ev_win;
}

// 下画面選択にコールバック関数を設定
//=============================================================================================
/**
 *
 *
 * @param   fsys
 * @param   func
 * @param   work
 */
//=============================================================================================
void FieldSubLcdControler_YNCallBackSet( FIELDSYS_WORK *fsys, void * func, void * work )
{
	SUBLCD_CONTROL_WORK * scw = TCB_GetWork(fsys->sublcd_controler);

	YesnoSublcdCallBackSet( scw->sublcd_tcb, func, work );
}

// フィールドメニュー選択フラグを設定
//=============================================================================================
/**
 *
 *
 * @param   fsys
 */
//=============================================================================================
void FieldSubLcdControler_FieldMenuEnterSet( FIELDSYS_WORK *fsys )
{
	SUBLCD_CONTROL_WORK * scw = TCB_GetWork(fsys->sublcd_controler);
	FieldMenuSelectFlagSet( scw->sublcd_tcb );
}

// ショートカット起動フラグ設定
//=============================================================================================
/**
 *
 *
 * @param   fsys
 * @param   shortcutID
 */
//=============================================================================================
void FieldSubLcdControler_FieldMenuShortcutFlagSet( FIELDSYS_WORK *fsys, int shortcutID )
{
	SUBLCD_CONTROL_WORK * scw = TCB_GetWork(fsys->sublcd_controler);
	GF_ASSERT( shortcutID > 0 && shortcutID < 3 );
	FieldMenuSelectShortcutFlagSet( scw->sublcd_tcb, shortcutID );
}

extern TCB_PTR UnionBoard_GetTaskPtr( void* work );


//=============================================================================================
/**
 *
 *
 * @param   bgl
 * @param   sub_panel_trg
 * @param   fsys
 * @param   work
 *
 * @retval  TCB_PTR
 */
//=============================================================================================
TCB_PTR UnionBoardSublcdInit( GF_BGL_INI* bgl, u16 *sub_panel_trg, FIELDSYS_WORK *fsys, void *work )
{
	fsys->sublcd_wk = UnionRoom_BoardInit( fsys );

	return (TCB_PTR)fsys->sublcd_wk;
}

//=============================================================================================
/**
 *
 *
 * @param   bgl
 * @param   tcb
 */
//=============================================================================================
void UnionBoardSelSublcdQuitReq( GF_BGL_INI* bgl, TCB_PTR tcb )
{
	UnionRoom_BoardEnd( (void*)tcb );
}


//=============================================================================================
/**
 *
 *
 * @param   bgl
 *
 * @retval  int
 */
//=============================================================================================
int UnionBoardSelSublcdQuitWait( GF_BGL_INI *bgl )
{
	return TRUE;
}



//-----------------------------------------------------------------------------
/**
 *	@brief	objcodeから「はなす」にならないobjか判定
 *
 *	@param	int obj_code
 *
 *	@retval
 */
//-----------------------------------------------------------------------------
BOOL FieldSublcd_ObjNoTalkCheck( int obj_code )
{
	static const u16 notalk_tbl[] =
	{
		ICE,
		GTROPHY,
		MEDAL,
		ROTOMF,
		ROTOMS,
		ROTOMI,
		ROTOMW,
		ROTOMG,
		STATUEHERO,
		STATUEHEROINE,
		ROCK,
		BREAKROCK,
		TREE,
		MONATERBALL,
		BONGURI,
		USOKKY,
		KANSHI,
		BTROPHY,
		SCROLL,
		SIGNSHOES,
		SIGNCLOTHES,
		SIGNPOKESTLE,
		SIGNPOKEGEAR,
		SIGNBALL,
		BUTUDAN,
		BOOK,
		LEAG_DOOR1,
		LEAG_DOOR2,
		ALFU_DOOR,
		ALFU_HOLE,
		STOP,
		STROPHY,
		POKEWALL,
		JUPETTA,
		MANENE,
		BONGURI,
		RSHUTTER,
		LSHUTTER,
		BOX,
		USHUTTER,
		DSHUTTER,
		DOOR3,
		DOOR4,
	};

	int i;

	for( i=0; i<NELEMS(notalk_tbl); i++ )
	{
		if( obj_code == notalk_tbl[i] )
		{
			return TRUE;
		}
	}

	return FALSE;
}

//-----------------------------------------------------------------------------
/**
 *	@brief	「しらべる」に固定するイベントをチェック
 *
 *	@param	int obj_code
 *
 *	@retval
 */
//-----------------------------------------------------------------------------
BOOL FieldSublcd_FrontEventCheck( int ev )
{
	// アイテム（隠し含む）
	if(	ev >= ID_FLD_ITEM_OFFSET && ev <= ID_HIDE_ITEM_OFFSET_END ){
		return TRUE;
	}
	// きのみ
	if( ev >= ID_KINOMI_OFFSET && ev <= ID_KINOMI_OFFSET_END ){
		return TRUE;
	}
	// ひでん
	if( ev >= ID_HIDEN_OFFSET && ev <= ID_HIDEN_OFFSET_END ){
		return TRUE;
	}
	// テレビ
	if( ev >= ID_TV_OFFSET && ev <= ID_TV_OFFSET_END ){
		return TRUE;
	}

	return FALSE;
}